package org.example.controller;

import jakarta.servlet.http.HttpSession;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MyController {

    @GetMapping("/login")
    public String login(HttpSession session) {
        session.setAttribute("logged", true);
        return "login success!";
    }

    @GetMapping("/source/source1")
    public String source1() {
        return "source1!";
    }

    @GetMapping("/source/source2")
    public String source2() {
        return "source2!";
    }


    @GetMapping("/logout")
    public String logout(HttpSession session) {
        session.removeAttribute("logged");
        return "logout ok!";
    }


    @GetMapping("/mylogin")
    public String mylogin() {
        return "mylogin !";
    }



    @GetMapping("/getUser")
    public String getUser() {
        return "getUser !";
    }







}
